<extend name="template/base_index" />

<block name="area_header">
    <style type="text/css">
        td{
            text-align: center;
        }
        td pre{
            HEIGHT: 160PX;
            width:480px;
        }
        .object-code{
            width:480px;
            HEIGHT: 160PX;
            display: block;
            margin:0 auto;
            word-wrap: break-word;
            text-align: left;
             overflow: scroll;
            overflow-x: hidden;
        }
    </style>
</block>

<block name="area_body">
    {:W('Menus/topbar')}
    <div class="admin-main container-fluid">
        {:W('Menus/left')}
        <div class="admin-main-content">
            {:W('Menus/breadcrumb')}

            <div class="h4">订单信息上报</div>
                <form>

                    <a href="javascript:history.back(-1);" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回</a>
                    <br>

                    <div class="form-group">
                        <!--<label>订单编号</label>-->
                        <!--<div class=" ">{$order.order_code}</div>-->
                        <label>上报订单编号</label>
                        <div class=" ">{$order.pay_code}</div>
                    </div>
                    <div class="form-group">
                        <label>订单包含的商品数</label>
                        <div class="form-control J_count">{$item_count}</div>
                    </div>

                     <div class="text-center">
                         <button type="button" data-loading-text="正在上报中..."  class="J_upload btn btn-sm btn-primary">上报订单数据</button>
                     </div>

                    <div class="js_info text-center">

                    </div>
                </form>

            <div class="" style="padding: 10px">
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <td>序号</td>
                        <td>返回结果</td>
                        <td>上报参数</td>
                        <td>上报时间</td>
                    </tr>
                    </thead>
                    <volist name="list" id="vo">
                        <tr>
                            <td>{$key+1}</td>
                            <td ><span class="object-code" title="{$vo.upload_content}">{:getZjportPersonalResult($vo['result'])}</span></td>
                            <td ><span class="object-code" title="{$vo.upload_content}">{$vo.upload_content}</span></td>
                            <td>{:date("Y-m-d H:i:s",$vo['upload_time'])}</td>
                        </tr>
                    </volist>
                </table>
                <div>{$show}</div>
            </div>

            </div>

    <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
</block>

<block name="area_footer">

    <script type="text/javascript">

        function upload(){
            var order_code = "{$order.order_code}";
            var item_count = "{$item_count}";

            $.ajax({
                url:"__SELF__",
                data:{order_code:order_code,item_count:item_count},
                type:"POST",
                beforeSend:function(){
                    $(".J_upload").button("loading");
                }
            }).always(function(){
                $(".J_upload").button("reset");
            }).done(function(data){
                console.log(data);
                if(data.status){

                    var info = data.info;
                    console.log("info=",info);
                    if(info.code == 0){
                        $(".js_info").text(info.data.stringOfResultDetail);
                        $(".js_info").addClass("text-success");
                        window.location.reload();
                    }
                }else{
                    $(".js_info").text(data.info);
                    $.scojs_message(data.info , $.scojs_message.TYPE_ERROR);
                }
            }).fail(function(){
                $.scojs_message("上报失败!请刷新后重试!", $.scojs_message.TYPE_ERROR);
            });

        }

        $(function(){

            $(".J_upload").click(function(){

                upload();

            });

        })


    </script>

</block>